﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ImpExpData.Interface;

namespace ImpExpData
{
    public partial class ExportForm : Form, IExportForm
    {
        public ExportForm()
        {
            InitializeComponent();
            beginDateTimePicker.Value = DateTime.Now;
            endDateTimePicker.Value = DateTime.Now;
            newDataRadioButton.Checked = true;
            dateDateTimePicker.Value = DateTime.Now;
        }

        private void repeatRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            repeatExportPanel.Visible = repeatRadioButton.Checked;
        }

        private void singleDataRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            datePanel.Visible = singleDataRadioButton.Checked;
        }

        #region IExportForm Members

        public bool IsVisits
        {
            get
            {
                return exportVisitsCheckBox.Checked;
            }
            set
            {
                exportVisitsCheckBox.Checked = value;
            }
        }

        public bool IsOrders
        {
            get
            {
                return ordersCheckBox.Checked;
            }
            set
            {
                ordersCheckBox.Checked = value;
            }
        }

        public bool OnlyExport
        {
            get { return onlyExportCheckBox.Checked; }
        }

        public TypeExport GetTypeExport
        {
            get
            {
                if (newDataRadioButton.Checked)
                    return TypeExport.OnlyNew;
                if (singleDataRadioButton.Checked)
                    return TypeExport.SingleDate;
                if (repeatRadioButton.Checked)
                {
                    return TypeExport.RepeatDate;
                }
                return TypeExport.OnlyNew;
            }
        }

        public event EventHandler<EventArgs> GoExportData;

        #endregion
    }
}